﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ATW.MT.BUS;
using System.Data;
using System.Text;

namespace ATW.MT.SellManage
{
    public partial class _exceptionList : System.Web.UI.Page
    {
        bus_T_Exception TE = new bus_T_Exception();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserInfo"] == null)
            {
                Response.Redirect("../Main/Login.aspx");
            }
            if (!IsPostBack)
            {
                BindData();
            }
        }
        private void BindData()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["cid"]))
            {
                string cid = Request.QueryString["cid"];
                try
                {
                    if (!CommonClass.common.filterChar(cid))
                    {
                        return;
                    }
                    DataTable dt = TE.ExceptionQuery(cid);
                    rpList.DataSource = dt;
                    rpList.DataBind();
                }
                catch (Exception ex)
                {

                }
            }
        }
        protected void lbnRead_Click(object sender, EventArgs e)
        {//标为已读
            LinkButton lbn = (LinkButton)sender;
            string exid = lbn.CommandArgument;
            try
            {
                int result = TE.readException(exid);
                if (result > 0)
                {
                    BindData();
                }
                else
                {
                    Tips("操作失败！");
                    return;
                }
            }
            catch (Exception ex)
            {

            }
        }
        private void Tips(string s)
        {//提示
            StringBuilder strScript = new StringBuilder();
            strScript.Append(@"<script language=javascript>
                var divTips=new jSharp.popUpDiv('divMsg');
                document.getElementById('msgContent').innerHTML='" + s + @"';
                divTips.Show();
                var t=setTimeout(function(){
                    divTips.Close();
                    clearTimeout(t);
                },1000);
            </script>");
            this.ClientScript.RegisterStartupScript(this.GetType(), "tips", strScript.ToString());
        }
    }
}